package com.zhong.quartz.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhong.common.utils.WrapperUtils;
import com.zhong.quartz.domain.SysJobLog;
import com.zhong.quartz.mapper.SysJobLogMapper;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 定时任务调度日志信息 服务层
 *
 * @author zhongzc
 */
@Service
public class SysJobLogService  extends ServiceImpl<SysJobLogMapper, SysJobLog>
{
    /**
     * 获取quartz调度器日志的计划任务
     *
     * @param jobLog 调度日志信息
     * @return 调度任务日志集合
     */
    public List<SysJobLog> selectJobLogList(SysJobLog jobLog)
    {
        return list(WrapperUtils.getQueryWrapper(jobLog));
    }

    /**
     * 新增任务日志
     *
     * @param jobLog 调度日志信息
     */
    public void addJobLog(SysJobLog jobLog)
    {
        save(jobLog);
    }

    /**
     * 批量删除调度日志信息
     *
     * @param logIds 需要删除的数据ID
     * @return 结果
     */
    public void deleteJobLogByIds(String[] logIds)
    {
        removeByIds(Arrays.asList(logIds));
    }

    /**
     * 清空任务日志
     */
    public void cleanJobLog()
    {
        baseMapper.cleanJobLog();
    }
}
